<template>
	<view class="success-page">
		<view class="success-icon">
			<text>✓</text>
		</view>
		<text class="success-title">提交成功</text>
		<text class="success-message">您的快递代取申请已提交，我们会尽快处理</text>

		<view class="order-info">
			<view class="info-item">
				<text class="info-label">取件码：</text>
				<text class="info-value">{{orderInfo.pickupCode}}</text>
			</view>
			<view class="info-item">
				<text class="info-label">取件地点：</text>
				<text class="info-value">{{orderInfo.pickupAddress}}</text>
			</view>
			<view class="info-item">
				<text class="info-label">收件人：</text>
				<text class="info-value">{{orderInfo.recipientName}} {{orderInfo.recipientPhone}}</text>
			</view>
			<view class="info-item">
				<text class="info-label">配送地址：</text>
				<text class="info-value">{{orderInfo.deliveryAddress}}</text>
			</view>
		</view>

		<button class="back-btn" @click="goBack">返回首页</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				orderInfo: {}
			}
		},
		onLoad(options) {
			// 从路由参数中获取订单信息
			this.orderInfo = JSON.parse(options.orderInfo || '{}');
		},
		methods: {
			goBack() {
				uni.switchTab({
					url:"/pages/index/index"
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.success-page {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		min-height: 100vh;
		padding: 40rpx;
		background: #f5f5f5;

		.success-icon {
			width: 120rpx;
			height: 120rpx;
			border-radius: 50%;
			background: #52c41a;
			display: flex;
			align-items: center;
			justify-content: center;
			margin-bottom: 30rpx;

			text {
				color: white;
				font-size: 60rpx;
				font-weight: bold;
			}
		}

		.success-title {
			font-size: 40rpx;
			font-weight: bold;
			color: #333;
			margin-bottom: 20rpx;
		}

		.success-message {
			font-size: 28rpx;
			color: #666;
			margin-bottom: 60rpx;
			text-align: center;
		}

		.order-info {
			width: 100%;
			background: white;
			border-radius: 16rpx;
			padding: 30rpx;
			margin-bottom: 60rpx;
			box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);

			.info-item {
				display: flex;
				margin-bottom: 20rpx;
				font-size: 28rpx;

				&:last-child {
					margin-bottom: 0;
				}

				.info-label {
					color: #666;
					width: 160rpx;
				}

				.info-value {
					color: #333;
					flex: 1;
				}
			}
		}

		.back-btn {
			width: 100%;
			height: 90rpx;
			border-radius: 45rpx;
			background: #1890ff;
			color: white;
			font-size: 32rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			border: none;

			&:active {
				background: #40a9ff;
			}
		}
	}
</style>